<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018\9\28 0028
 * Time: 16:52
 */

namespace app\index\interfaceIn;


use app\Lib\Exception\BlException;
use app\Lib\InterfaceIn\Api\Api;
use app\Lib\Ioc\Role\RoleManage;

class getRoleList extends Common implements Api
{
    /**
     * 参数验证
     * @return mixed
     * @throws BlException
     */
    public function handle()
    {
        $this->check();
        $data   =  $this->param->postData;
        $result = (new RoleManage())->getList($data);
        return $this->returnCreate($result);
    }

    /**
     * 参数验证
     * @throws BlException
     */
    public function check()
    {
        $data   =  $this->param->postData;
        if(empty($data['page']) || !is_numeric($data['page'])){
            throw new BlException('页码参数错误');
        }
        if(empty($data['limit']) || !is_numeric($data['limit'])){
            throw new BlException('条数参数错误');
        }
        return true;
    }

}